package com.brzjomo.embraceofthevoid.init;

import com.brzjomo.embraceofthevoid.EmbraceOfTheVoid;
import com.brzjomo.embraceofthevoid.items.BlessTeleportGem;
import com.brzjomo.embraceofthevoid.items.NBTStick;
import com.brzjomo.embraceofthevoid.items.NightFallTeleportGem;
import com.brzjomo.embraceofthevoid.items.TeleportGemCore;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;

import java.util.Objects;

public class ModItems {
    // Items
    public static final NightFallTeleportGem NIGHTFALL_TELEPORT_GEM = new NightFallTeleportGem(new Item.Settings().rarity(Rarity.EPIC).fireproof().maxCount(1).maxDamage(6));
    public static final BlessTeleportGem BLESS_TELEPORT_GEM = new BlessTeleportGem(new Item.Settings().rarity(Rarity.EPIC).fireproof().maxCount(1).maxDamage(3));
    public static final TeleportGemCore TELEPORT_GEM_CORE = new TeleportGemCore(new Item.Settings().rarity(Rarity.EPIC).fireproof());
    public static final NBTStick NBT_STICK = new NBTStick(new Item.Settings().rarity(Rarity.RARE).fireproof().maxCount(1));

    // Block Items
    public static final BlockItem VILLAGER_ALTAR = new BlockItem(ModBlocks.VILLAGER_ALTAR, new Item.Settings().rarity(Rarity.EPIC).fireproof().maxCount(16));

    // Item List
    public static final Item[] ITEM_LIST = {NIGHTFALL_TELEPORT_GEM, BLESS_TELEPORT_GEM, TELEPORT_GEM_CORE, NBT_STICK};
    public static final Item[] BLOCK_ITEM_LIST = {VILLAGER_ALTAR};

    // Item Path
    public static final String NIGHTFALL_TELEPORT_GEM_PATH = "nightfall_teleport_gem";
    public static final String BLESS_TELEPORT_GEM_PATH = "bless_teleport_gem";
    public static final String TELEPORT_GEM_CORE_PATH = "teleport_gem_core";
    public static final String NBT_STICK_PATH = "nbt_stick";

    // Block Item Path
    public static final String VILLAGER_ALTAR_PATH = "villager_altar";

    // Get Path
    public static String getPath(Item itemIn) {
        if (itemIn.equals(NIGHTFALL_TELEPORT_GEM)) {
            return NIGHTFALL_TELEPORT_GEM_PATH;
        } else if (itemIn.equals(BLESS_TELEPORT_GEM)) {
            return BLESS_TELEPORT_GEM_PATH;
        } else if (itemIn.equals(TELEPORT_GEM_CORE)) {
            return TELEPORT_GEM_CORE_PATH;
        } else if (itemIn.equals(NBT_STICK)) {
            return NBT_STICK_PATH;
        } else if (itemIn.equals(VILLAGER_ALTAR)) {
            return VILLAGER_ALTAR_PATH;
        } else {
            return null;
        }
    }

    // Get ID
    public static Identifier getId(Item itemIn) {
        return new Identifier(EmbraceOfTheVoid.MOD_ID, Objects.requireNonNull(getPath(itemIn)));
    }
}
